﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
    <script type="text/javascript">

        const methodPath = "https://localhost:5021/api/person";

        function MethodGet1() {
            $.ajax({
                type: "get",
                url: methodPath + "/GetByModel1",
                contentType: "application/json",
                data: { ID: "1", NAME: "Jim", CREATETIME: "1988-09-11" },
                success: function (data, status) {
                    if (status == "success") {
                        $("#res").html(data);
                    }
                }
            });
        }


        function MethodGet2() {
            $.ajax({
                type: "get",
                url: methodPath + "/GetByModel2",
                contentType: "application/json",
                data: { strQuery: JSON.stringify({ ID: "1", NAME: "Jim", CREATETIME: "1988-09-11" }) },
                success: function (data, status) {
                    if (status == "success") {
                        $("#res").html(data);
                    }
                }
            });
        }


        function MethodPost1() {
              
            $.ajax({
                type: "post",
                url: methodPath+"/SaveData1",
                contentType: 'application/json',
                data: JSON.stringify({ NAME: "Jim", DES: "备注" }),
                success: function (data, status) {
                    $("#res").html(data);}
            });
        }





    </script>

    <style type="text/css">
        button {
            width: 80px;
            height: 30px;
            border-radius: 2em 1em 4em / 0.5em 3em;
            color: #ff0000;
            background-color: #ffffff;
            margin: 20px;
        }
    </style>
</head>
<body>
    <div>
        <button type="button" onclick="MethodGet1()">Get1</button>
        <button type="button" onclick="MethodGet2()">Get2</button>

        <br />

        <button type="button" onclick="MethodPost1()">Post1</button>

    </div>
    <div>
        <p>返回结果:</p><p id="res"></p>
    </div>
</body>
</html>